const init_state = {
  title: '云梦遥',
  num: 123
}

export default (state=init_state, action)=>{
  //深复制(state为readOnly)
  let newState = JSON.parse(JSON.stringify(state))
  switch(action.type){
    case 'ADD':
      newState.num += action.payload.number
      break
    case 'SUB':
      newState.num -= action.payload.number
      break;
    default:
      break
  }
  return newState
}